package com.example.binpacking.controller;

import com.example.binpacking.model.Result;
import com.example.binpacking.model.dto.OperationLoginTableInformationDto;
import com.example.binpacking.service.OperationLoginTableInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pelicanpsyc")
public class OperationLoginTableInformationController {

    @Autowired
    private OperationLoginTableInformationService operationLoginTableInformationService;
    @PostMapping("/api/operation")
    public Result getData(@RequestBody OperationLoginTableInformationDto operationLoginTableInformationDto) {
        try {
            Object result = operationLoginTableInformationService.handleRequest(operationLoginTableInformationDto.getUsertype(),operationLoginTableInformationDto.getLoginid(), operationLoginTableInformationDto.getAction());
            return Result.success(result);
        } catch (Exception e) {
            return Result.fail(200,"n","[]");
        }
    }
}
